﻿using System;
using Autodesk.Revit.DB;

namespace YJKPatternSign.StairsRoomPlanSign.ControlLayer
{
	public class MakeFillRegionLinker
	{
		public void MakeFillRegion()
		{
			if (SignManger.ThisStairPlandDataPacker != null)
			{
				WallAndColumnFillOper wallAndColumnFillOper = new WallAndColumnFillOper(SignManger.Uidoc, SignManger.ThisStairPlandDataPacker);
				TransactionGroup transactionGroup = new TransactionGroup(SignManger.Doc, "filledRegion");
				try
				{
					transactionGroup.Start();
					wallAndColumnFillOper.FillRegion();
					transactionGroup.Assimilate();
				}
				catch (Exception)
				{
					if (transactionGroup.HasStarted())
					{
						transactionGroup.RollBack();
					}
				}
			}
		}
	}
}
